package me.yxy.mobanddd.domain.domainservice;

import lombok.Getter;
import org.springframework.stereotype.Service;

import java.util.Random;

/**
 * 计算收货人的精确地址
 */
@Service
public class LocatingReceiverService {

    public LocatingResult process(String locationDetail){


        try {
            Thread.sleep(300);
        } catch (InterruptedException e) {
        }

        int seed = locationDetail.length();
        Random random = new Random(seed);
        Double longitude = 31.0 + random.nextDouble();
        Double latitude = 121.0 + random.nextDouble();

        return new LocatingResult(longitude,latitude);
    }

    @Getter
    public class LocatingResult{
        private Double longitude;
        private Double latitude;

        public LocatingResult(Double longitude, Double latitude) {
            this.longitude = longitude;
            this.latitude = latitude;
        }
    }

}
